package fr.iut2.tc1.shared;

public class UnTroll 
{
	private Race race;
	private Competence[] competences;
	private String nom;
	
	private int attaque;
	private int degats;
	private int esquive;
	private int regeneration;
	private int pointDeVie;
	private String image;
	
	private final int nbPointsCarac = 50; 
	private final int nbPointsComp = 20; 
	
	public UnTroll(String nom,String type,String image)
	{
		this.race = new Race(type);
		this.competences = race.getCompetence();
		this.nom=nom;
		this.image=image;
	}
	
	//On met les points de compétences
	public void setPointsCompetence(int a,int b)
	{
		if(a+b<=nbPointsComp)
		{
			this.competences[0].setPoints(a);
			this.competences[1].setPoints(b);
		}
	}
	
	public String getNomImage()
	{
		return this.image;
	}
	
	//On met les caract�ristiques
	public void setCaracteristiques(int attaque,int degat,int esquive,int regeneration, int pointDeVie)
	{
		if(attaque+degat+esquive+regeneration+pointDeVie <= nbPointsCarac)
		{
			this.attaque=attaque;
			this.degats = degat;
			this.esquive = esquive;
			this.regeneration=regeneration;
			this.pointDeVie=pointDeVie;
		}
		
	}
	
	public int[] getPointCompetence()
	{
		return new int[]{this.competences[0].getPoints(),this.competences[1].getPoints()};
	}
	
	public int[] getPointCaracteristique()
	{
		return new int[]{attaque,degats,esquive,regeneration,pointDeVie};
	}
	
	public Race getRace()
	{
		return this.race;
	}
	
	public Competence[] getCompetence()
	{
		return this.competences;
	}
	
	public String getNom()
	{
		return this.nom;
	}
}
